﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Collections.Generic;

using TRPOP.Config;
using TRPOP.Common;
using TRPOP.CMS.Plugin;


namespace TRPOP.CMS.Web.UI
{
    public class SwfUpload_Thumbnail : BaseAdmin
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["jsNode"] == null)
            {
                Alert("请通过编辑器上传图片");
                Response.End();
            }

            string id = Request.QueryString["id"] as string;
            Response.Clear();
            if (id == null)
            {
                Response.StatusCode = 404;
                Response.Write("Not Found");
                Response.End();
                return;
            }
            List<AttachmentInfo> thumbnails = Session["admin_uploadfiles"] as List<AttachmentInfo>;
            if (thumbnails == null)
            {
                Response.StatusCode = 404;
                Response.Write("Not Found");
                Response.End();
                return;
            }
            if (thumbnails.Count >= int.Parse( id))
            {
                
                Response.Write(thumbnails[int.Parse(id)-1].FileName);
                Session["admin_uploadfiles"] = null;
                Response.End();
                return;
            }

            Response.StatusCode = 404;
            Response.Write("Not Found");
            Response.End();
        }
    }
}
